#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QWidget>
#include"musiclist.h"
#include<QMediaPlaylist>

namespace Ui {
class CommonPage;
}

enum PageType
{
   LIKE_PAGE,
   LOCAL_PAGE,
   HISTORY_PAGE
};


class CommonPage : public QWidget
{
    Q_OBJECT

public:
    explicit CommonPage(QWidget *parent = nullptr);
    ~CommonPage();
    void setCommonPage(const QString& text,const QString& imagePath);
    //给定musicList将musiclist中的音乐添加到具体的页面
    void addMusicToMusicPage(MusicList& musicList);
    void reFresh(MusicList& musicList);
    void setPageType(PageType pageType);
    PageType getPageType();
    //将每页的music对象加入要播放的playlist中
    void addMusicToPlayList(MusicList& musicList,QMediaPlaylist* playList);

    QString getMusicIdByIndex(int index);
    void setImageLabel(QPixmap map);
signals:
    void updateLikeMusic(bool IsLike,QString musicId);
    void playAll(PageType pagetype);
    void playMusicByIndex(CommonPage* ,int index);

    //将歌曲刷新到对应的页面的
private slots:
    void on_playAllBtn_clicked();

private:
    Ui::CommonPage *ui;
    PageType pagetype; //页面的具体类型
    QVector<QString> musicListOfPage;//具体某个页面的音乐,村音乐的uuid即可



};

#endif // COMMONPAGE_H
